home *** CD-ROM | disk | FTP | other *** search
- #ifndef GAME_H
- #define GAME_H
-
- typedef enum { PAWN, BISHOP, ROOK, KING } GAME_PIECE;
- typedef struct {
- int vertical;
- } PAWN_MOVE_STRUCT;
-
- typedef PAWN_MOVE_STRUCT *PAWN_MOVE;
-
- typedef struct {
- int diagonal;
- } BISHOP_MOVE_STRUCT;
-
- typedef BISHOP_MOVE_STRUCT *BISHOP_MOVE;
-
- typedef struct {
- int vertical;
- int horizontal;
- } ROOK_MOVE_STRUCT;
-
- typedef ROOK_MOVE_STRUCT *ROOK_MOVE;
-
- typedef struct {
- int vertical;
- int horizontal;
- int diagonal;
- } KING_MOVE_STRUCT;
-
- typedef KING_MOVE_STRUCT *KING_MOVE;
-
- typedef union {
- PAWN_MOVE PawnM;
- BISHOP_MOVE BishopM;
- ROOK_MOVE RookM;
- KING_MOVE KingM;
- } MOVE_U;
-
- typedef MOVE_U *MOVE;
-
- class piece {
-
- public:
- piece (); // constructor and destructor have the
- ~piece (); // same name as the class.
- piece_position (); // declaration of public interfaces to
- pawn_move (); // the class piece.
- bishop_move ();
- rook_move ();
- king_move ();
- private:
- GAME_PIECE piece_type; // private data for the class
- MOVE move; // piece. Can only be accessed
- int x_coord; // through encapsulated member
- int y_coord; // functions or friends.
- };
-
- #endif // GAME_H
-